package com.ruoyi.common.core.domain

import com.fasterxml.jackson.annotation.JsonInclude
import com.ruoyi.common.core.domain.entity.SysDept
import com.ruoyi.common.core.domain.entity.SysMenu
import java.io.Serializable

/**
 * Treeselect树结构实体类
 *
 * @author ruoyi
 */
class TreeSelect : Serializable {
    /** 节点ID  */
    var id: Long? = null

    /** 节点名称  */
    var label: String? = null

    /** 子节点  */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    var children: List<TreeSelect>? = null

    constructor()
    constructor(dept: SysDept?) {
        id = dept?.deptId
        label = dept?.deptName
        children = dept?.children?.map { sysDept: SysDept? -> TreeSelect(sysDept) }?.toList()
    }

    constructor(menu: SysMenu?) {
        id = menu?.menuId
        label = menu?.menuName
        children = menu?.children?.map { sysMenu: SysMenu? -> TreeSelect(sysMenu) }?.toList()
    }

    companion object {
        private const val serialVersionUID = 1L
    }
}
